package com.xiaobao.coalproperty;

import android.annotation.SuppressLint;
import android.app.AlarmManager;
import android.app.Application;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

import com.xiaobao.coalproperty.other.util.FormatUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@SuppressLint({"ServiceCast", "NewApi", "MissingPermission"})
public class App extends Application {

    private static App mApp;

    private List<String> startTimeList;

    @Override
    public void onCreate() {
        super.onCreate();
        mApp = this;
        initTimeList();
    }

    public static App getContext() {
        return mApp;
    }

    public List<String> getStartTimeList() {
        return startTimeList;
    }

    public void initTimeList() {
        new Thread(initTimeRunnable).start();
    }

    private Runnable initTimeRunnable = new Runnable() {
        @Override
        public void run() {
            long current = System.currentTimeMillis();
            int count = 0;
            startTimeList = new ArrayList<>();
            while (count < 3650) {//十年前
                startTimeList.add(FormatUtils.getInstance().formatDate(new Date(current)));
                current -= 86400 * 1000;
                count++;
            }
        }
    };


}
